import React, { PureComponent } from 'react'
import { Layout } from 'antd'
import { Outlet } from '@umijs/max'
import SiderMenu from '../layout/components/SiderMenu'
import styles from './index.less'

const { Content } = Layout

class BasicLayout extends PureComponent {
  constructor(props) {
    super(props)
    this.state = {
      isOS: process.env.APP_ENV === 'os',
    }
  }

  render() {
    const isQues = /custom-form-ques/.test(window.location.href) || /hist-report-data/.test(window.location.href) || /index-management/.test(window.location.href)
    const isMobile = /iPhone|iPod|Android|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone/i.test(navigator.userAgent)
    const { isOS } = this.state
    const style = isOS ? styles.layoutOS : styles.layout
    return (
      <Layout className={isMobile ? '' : style}>
        {!isQues && <SiderMenu />}
        <Content id="layout_container_content" className={styles.container_content}>
          <Outlet />
        </Content>
      </Layout>
    )
  }
}
export default BasicLayout
